perm filename A104.TEX[106,RWF]1 blob
sn#807814 filedate 1985-11-05 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 \magnification\magstephalf
C00004 ENDMK
C⊗;
\magnification\magstephalf
\input macro.tex
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
\baselineskip 14pt
\rm
\line{\sevenrm a104.tex[106,phy] \today\hfill}
\font\rmn=amr9
{\rmn
{\narrower\smallskip\noindent
{\bf Exercise.}
\noindent
Write a program that reads two polynomials
$a(x)=a↓0+a↓1x+a↓2x↑2+\cdots +a↓mx↑m$,
$b(x)=b↓0+b↓1x+b↓2x↑2+\cdots +b↓mx↑m$,
and prints the quotient $q(x)$ and remainder $r(x)$ when $a(x)$
is divided by $b(x)$. For example, if
$$\eqalignno{a(x)&=4+6x+10x↑2+10x↑3+5x↑4+2x↑5\,,\cr
b(x)&=1+2x+1x↑2\,,\cr
\noalign{\hbox{\hskip20pt{then}}}
q(x)&=1+3x+3x↑2+1x↑3\,,\cr
r(x)&=3+1x\,.\cr}$$
Assume $b↓n≠0$. Use {\tt REAL} arithmetic.
Input convention: $a↓0a↓1a↓2\ldots$ sentinel $b↓0b↓1b↓2\ldots b↓n$ sentinel
where any number larger than $10↑6$ will work as a sentinel.
\smallskip}
}
\bigskip
\line{\copyright 1984 Robert W. Floyd; \hfil}
%First draft (not published) ??\hfil}
%revised: Date; subsequently revised.\hfill}
\bye